package com.sitechasia.webx.components.xtable.toolbar;

import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.table.view.AbstractHtmlView;
import org.extremecomponents.util.HtmlBuilder;

/**
 * 本类为toolbar在table中的样例
 * 要根据具体样式更改styleClass的定义
 *
 */

public class CustomToolbarPageFooterView extends AbstractHtmlView {
	@Override
	protected void beforeBodyInternal(TableModel model) {
		getTableBuilder().tableStart();
		getTableBuilder().getHtmlBuilder().tr(2).close();
		getTableBuilder().getHtmlBuilder().td(2).width("100%").close();
		getTableBuilder().getHtmlBuilder().table(2).styleClass("DoubleColorTable1").width("100%").cellPadding("0")
				.cellSpacing("0").close();
		getTableBuilder().theadStart();

		getTableBuilder().titleRowSpanColumns();
		getTableBuilder().filterRow();
		getTableBuilder().headerRow();
		getTableBuilder().theadEnd();
		getTableBuilder().tbodyStart();
	}

	@Override
	protected void afterBodyInternal(TableModel model) {
		getCalcBuilder().defaultCalcLayout();

		getTableBuilder().tbodyEnd();
		getTableBuilder().getHtmlBuilder().tableEnd(2);
		getTableBuilder().getHtmlBuilder().tdEnd();
		getTableBuilder().getHtmlBuilder().trEnd(2);

		toolbar(getHtmlBuilder(), getTableModel());

		getTableBuilder().tableEnd();
	}

	protected void toolbar(HtmlBuilder html, TableModel model) {

		(new CustomPageToolbar(html, model)).layout();
	}

	protected void statusBar(HtmlBuilder html, TableModel model) {

		(new CustomPageToolbar(html, model)).layout();
	}
}